import 'dart:async';

import 'package:flutter/material.dart';

class StartPage extends StatefulWidget {
  StartPage({Key key}) : super(key: key);

  @override
  _StartPageState createState() => _StartPageState();
}

class _StartPageState extends State<StartPage> {
  Timer _timer;

  void startTime() async {
    var _duration = new Duration(seconds: 3);
    _timer = new Timer(_duration, jumpHome);
  }

  void jumpHome() {
    _timer.cancel();
    Navigator.of(context).pushReplacementNamed("/home");
  }

  @override
  void initState() {
    super.initState();
    startTime();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ConstrainedBox(
        constraints: BoxConstraints.expand(),
        child: Image.asset(
          'images/start-page.jpg',
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}
